home *** CD-ROM | disk | FTP | other *** search
- Subject: Re:More on Stack Crash...
- Sent: 6/28/96 9:25 AM
- Received: 7/1/96 8:34 AM
- From: Greg Friedman, friedman@cognosis.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- At 9:26 PM 6/27/96, The3Furies@aol.com wrote:
- > I just found some new info on my stack crash - it is dying in another
- > part's code. Lets call the part I'm creating stationery for Part A
- > (a container) and the other Part B (a non-container).
-
- During stationery creation, there shouldn't be any "other part's code" to
- reference.
-
- > I reference Part B directly from my code in Part A (I include the .xh
- > and get the part from the embedded frame. I also include Part B
- > in my project as a library <- a mistake???), but this only happens
- > when a Part B is actually embedded. I have noticed that since doing
- > this, the debugger does not load the sym file etc when I first drop
- > a Part B into Part A. Do I need to explicitly load the SOM part
- > for Part B from Part A at some point? Since I didn't load the part,
- > how did it get into my stack to begin with? Is the CFM trying to
- > release a fragment that never actually got loaded? I am confused...
- > and now you probably are too.
-
- I'm not sure I understand what you are doing here. Why are you including
- the other part's .xh? Parts should always reference other parts via their
- ODPart API. If you are trying to add additional methods to the SOM
- interface of one of your parts, and call those methods directly from
- another of your parts, I suggest you do not do this. You should, instead,
- use extensions. Your client part should call your server parts HasExtension
- and AcquireExtension methods. This shouldn't require access to your server
- part's .xh file, since these methods are defined in the .xh file of ODPart.
-
- Your client part needs to link against _something_ that exports the class
- data for the extension you are trying to write. The best way to do this is
- to create a shared library (not a part, just a shared library) that
- implements the extension and exports the extensions class data symbol
- (remember that with SOM, you should never export all of the methods of SOM
- objects, just their class data symbol).
-
- There are two basic approaches that work for implementing extensions in
- standalone libraries. The first is to implement the extension in the shared
- library such that when an extension is created, it is initialized with a
- collection of callbacks into the part that creates it. The callbacks should
- be simple C methods, defined in "extern "C"" scope to prevent name
- mangling. They should not be exported by the part. When a method of the
- extension is called, it makes a callback into the part, which does the
- right thing. I like this method.
-
- The other approach is to implement the standalone library as an abstract
- base class. With this implementation, you must create a uniquely named SOM
- subclass of the extension for every server part you write. The server part
- then statically links the SOM subclass. Client parts link against the
- standalone library, they do not need to link against the server part.
-
- In both cases, client parts should weaklink against the extension library.
- This will enable them to run if the shared library isn't installed.
-
- Hope this helps,
-
- gsf.
-
-
- _________________________________________________________
- Greg Friedman ODF Engineering Apple Computer
-
-